import Vue from 'vue'
import Router from 'vue-router'

let Layout = () => import('../page/Layout')
let Login = () => import('../page/Login')
let Home = () => import('../page/Home')
let News = () => import('../page/News')
let User = () => import('../page/User')
let Brand = () => import('../page/Brand')
let Brand2 = () => import('../page/Brand2')

Vue.use(Router)

let routes = [
    {
        path:'/',
        component:Layout,
        redirect:'/home',
        children:[
            {
               path:'/home',
               component: Home
            },
            {
               path:'/news',
               component: News
            },
            {
               path:'/user',
               component: User
            },
            {
               path:'/brand',
               component: Brand
            },
            {
               path:'/brand2',
               component: Brand2
            },
        ]
    },
    {
        path:'/login',
        component:Login
    }
]

let router = new Router({
    routes,
    linkActiveClass:'active'
})

// 导航前置守卫
router.beforeEach((to,from,next)=>{
    next()
})

export default router